package tasks;

import java.io.ObjectOutputStream;
import java.io.Serializable;

import comm.ClientPriority;

import client.ClientDescription;

public class TaskDescription implements Comparable<TaskDescription>,Serializable{
	private Task task;
	private ClientDescription client;
	private int taskid;
	private int numberOfTasks;
	
	public TaskDescription(Task task, ClientDescription client, int taskid) {
		super();
		this.task = task;
		this.client = client;
		this.taskid = taskid;
	}
	
	public Task getTask() {
		return task;
	}
	public ClientDescription getClient() {
		return client;
	}

	@Override
	public int compareTo(TaskDescription other) {
		int clientComp =  client.compareTo(other.getClient());
		if (clientComp == 0){
			return task.compareTo(other.task);
		}
		return clientComp;
	}

	public  ObjectOutputStream getClientOutStream() {
		return client.getOut();
	}

	public int getProblemNumber() {
		return client.getProblemNumber();
	}

	public int getVersion() {
		return client.getVersion();
		
	}
	
	public int getClientID(){
		return client.getID();
	}
	
	public int getTaskId(){
		return taskid;
	}

	public void setNumberOfTasks() {
		this.numberOfTasks++;
	}

	public int getNumberOfTasks() {
		return numberOfTasks;
	}
	
	public ClientPriority getPriority(){
		return client.getPriority();
	}

}
